import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:vischat/core/constants/asset_paths.dart';

class AppAvatar extends StatelessWidget {
  final GestureTapCallback? onTap;
  final String avatar;
  final double? size1;
  final double? size2;
  const AppAvatar({
    super.key,
    this.onTap,
    required this.avatar,
    this.size1,
    this.size2,
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: CircleAvatar(
        backgroundColor: Colors.white,
        radius: size1 ?? 60.sp,
        child: CircleAvatar(
          radius: size2 ?? 58.sp,
          backgroundImage:
              avatar.isEmpty
                  ? AssetImage(AssetPaths.defaultAvatar)
                  : NetworkImage(avatar),
        ),
      ),
    );
  }
}
